package com.zikao.question.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.zikao.question.entity.Text2Entity;
import com.zikao.question.service.Text2Service;
import com.zikao.common.utils.PageUtils;
import com.zikao.common.utils.R;



/**
 * 
 *
 * @author likaisheng
 * @email 1805318928@qq.com
 * @date 2021-03-03 20:45:59
 */
@RestController
@RequestMapping("question/text2")
public class Text2Controller {
    @Autowired
    private Text2Service text2Service;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("question:text2:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = text2Service.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("question:text2:info")
    public R info(@PathVariable("id") Long id){
		Text2Entity text2 = text2Service.getById(id);

        return R.ok().put("text2", text2);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("question:text2:save")
    public R save(@RequestBody Text2Entity text2){
		text2Service.save(text2);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("question:text2:update")
    public R update(@RequestBody Text2Entity text2){
		text2Service.updateById(text2);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("question:text2:delete")
    public R delete(@RequestBody Long[] ids){
		text2Service.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
